#ifndef _DECORATOR_H_
#define _DECORATOR_H_

#include <iostream>
#include "Component.h"

class Decorator : public Component{
public:
    Component* component;

public:
    void SetComponent(Component* component) {
        this->component = component;
    }

    void Operation() override{
        if (nullptr != this->component) {
            this->component->Operation();
        }
    }
};

class ConcreteDecoratorA : public Decorator {
public:
    std::string addState;

public:
    void Operation() override {
        Decorator::Operation();

        addState = "New State";
        std::cout << "具体装饰对象A的操作" << std::endl;
    }
};

class ConcreteDecoratorB : public Decorator {
public:
    void Operation() override {
        Decorator::Operation();

        AddedBehavior();
        std::cout << "具体装饰对象B的操作" << std::endl;
    }

private:
    void AddedBehavior() {}
};

#endif